package com.bawei.module_live.version2.mvi.model.repository


import com.bawei.lib_net.RetrofitFactory
import com.bawei.module_live.version2.mvi.model.api.LiveApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn

class LiveRepository {
    val api: LiveApi
    init {
        api= RetrofitFactory.getRetrofitFactory().create(LiveApi::class.java)
    }
    /**
     * 获取视频信息
     */
    suspend fun getSimpleType() = flow {
        emit(api.getLive())
    }.flowOn(Dispatchers.IO)

    suspend fun getRedPacket() = flow {
        emit(api.getredpacket( mapOf("room_id" to "111") ))
    }.flowOn(Dispatchers.IO)

}